package gameobjects
{
	import assets.Globals;
	
	import com.greensock.TweenMax;
	import com.greensock.easing.Linear;
	
	import flash.events.Event;

	public class InvisibleProjectile extends Projectile
	{
		protected var attacker:Enemy;
		
		public function getAttacker():Enemy
		{
			return attacker;
		}
		
		public function InvisibleProjectile(attacker:Enemy, dmgHP:Number=16, dmgSlow:Number=0, dmgShield:Number=0, passThrough:Boolean=false, passHops:int=2)
		{
			super(dmgHP, dmgSlow, dmgShield, passThrough, passHops);
			
			this.attacker = attacker;
			
			cs.x = 4;
			cs.y = 64;
			cs.graphics.beginFill(0x0000FF);
			cs.graphics.drawCircle(0, 0, 10);
			cs.graphics.endFill();
			cs.alpha = 0;
			
			addChild(cs);
		}
		
		override protected function init(event:Event):void
		{
			myTween = new TweenMax(this, 2, {  x: x-800, y : y, ease:Linear.easeNone });
			Globals.invisibles.push(this);
		}
		
		override public function destroy():void
		{
			myTween.kill();
			Globals.invisibles.splice(Globals.projectiles.indexOf(this), 1);
			super.destroy();
		}
	}
}